package com.itheima.service.impl;

import com.itheima.service.AccountService;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Service;

@Service("accountService")
public class AccountServiceImpl implements AccountService {
    public void add() {
        System.out.println("add...");
    }

    public void update() {
        System.out.println("update...");
    }

    public void delete() {
        System.out.println("delete...");
    }

    public String findAll(String data) {
        int i = 1 / 0;
        System.out.println("findAll...");
        return data;
    }

    public Object aroundMethod(ProceedingJoinPoint pjp) {
        System.out.println("环绕通知之前前置通知...");
        Object proceed = null;
        try {
            proceed = pjp.proceed();
            System.out.println("环绕通知之后后置通知");
        } catch (Throwable throwable) {
            throwable.printStackTrace();
            System.out.println("环绕通知异常通知");
        } finally {
            System.out.println("环绕通知最终通知");
        }
        return proceed;
    }
}
